#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<set>
#include<bitset>
#include<complex>
#include<assert.h>
#include<list>
#define inc(i,l,r) for(int i=l;i<=r;i++)
#define dec(i,l,r) for(int i=l;i>=r;i--)
#define link(x) for(edge *j=h[x];j;j=j->next)
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
#define eps 1e-8
#define succ(x) (1<<x)
#define mid (x+y>>1)
#define lowbit(x) (x&(-x))
#define sqr(x) (1ll*(x)*(x))
#define NM 4005
#define nm 200005
using namespace std;
const double pi=acos(-1);
const int inf=1e9+7;
ll read(){
    ll x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return f*x;
}
 
 
struct P{
    int x,y;
    bool operator<(const P&o)const{return y<o.y||(y==o.y&&x>o.x);}
}a[NM];
int n,c[NM],f[NM][NM],ans[NM],tot;
int _x,_t;
 
struct node{
    int x,y;
    node*l,*r;
    int ans,tag,t;
    node(int x,int y,node*l=0,node*r=0):x(x),y(y),l(l),r(r),ans(-inf),tag(0),t(-inf){}
    void upd(){ans=max(l->ans,r->ans);}
    void push(){
    if(tag){
        l->tag+=tag;r->tag+=tag;
        l->ans+=tag;r->ans+=tag;
        tag=0;
    }
    }
    void mod(){
    if(_x<=x){
        ans--;tag--;
        return;
    }
    push();if(_x<=mid)l->mod();r->mod();upd();
    }
    void ch(){
    if(x==y){
        ans-=t;
        t=max(t,_t);
        ans+=t;
        return;
    }
    push();if(_x<=mid)l->ch();else r->ch();upd();
    }
    void clear(){
    ans=t=-inf;tag=0;
    if(x==y)return;
    l->clear();r->clear();
    }
}*root;
node*build(int x,int y){return x==y?new node(x,y):new node(x,y,build(x,mid),build(mid+1,y));}
 
int main(){
    n=read();
    inc(i,1,n)c[++tot]=a[i].x=read(),c[++tot]=a[i].y=read();
    sort(c+1,c+1+tot);tot=unique(c+1,c+1+tot)-c-1;
    inc(i,1,n)a[i].x=lower_bound(c+1,c+1+tot,a[i].x)-c,a[i].y=lower_bound(c+1,c+1+tot,a[i].y)-c;
    sort(a+1,a+1+n);
    root=build(0,tot);
    inc(i,1,n)f[i][0]=-inf;
    inc(i,1,n){
    root->clear();
    inc(j,1,n){
        f[i][j]=-inf;
        int t=lower_bound(a,a+1+n,P{a[j].x,a[j].x})-a-1;
        _x=a[j].x;_t=f[i-1][t];if(f[i-1][t]>=0)root->ch();
        _x=a[j].x+1;if(_x<=tot)root->mod();
        if(root->ans>-inf)f[i][j]=root->ans+j;else f[i][j]=-inf;
    }
    }
    /*
    static int _f[NM][NM],b[NM][NM];
    inc(i,1,n)inc(j,1,a[i].x)b[j][a[i].y]++;
    inc(i,1,tot)inc(j,1,tot)b[i][j]+=b[i][j-1];
    inc(i,1,tot)_f[1][i]=b[1][i];
    inc(i,2,n){
    inc(j,i,tot)inc(k,i-1,j-1)if(_f[i][j]<_f[i-1][k]+b[k+1][j]&&b[k+1][j]>0&&_f[i-1][k]>0){
        _f[i][j]=_f[i-1][k]+b[k+1][j];
    }
    }
    */
    /*
    inc(i,1,n){inc(j,1,tot)printf("%d ",_f[i][j]);putchar('\n');}
    printf("----\n");
    */
    //inc(i,1,n){inc(j,1,n)printf("%d ",f[i][j]);putchar('\n');}
    inc(i,1,n)inc(j,1,n)if(f[i][j]>0)ans[n-f[i][j]]=max(ans[n-f[i][j]],i);
    inc(i,1,n-1)ans[i]=max(ans[i],ans[i-1]);
    inc(i,0,n-1)printf("%d%c",min(ans[i],n-i)," \n"[i==n-1]);
    return 0;
}
